{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Regression Design\n",
    "Given the data features, we are interested to run a regression which investigate the how monetary policies affect annual individual consumption growth after $ l=0, 1, 2,\\dots $ months:\n",
    "$$\n",
    "\\log(c_{i,t+12})-\\log(c_{i,t})=\\alpha+\\beta^{X}\\cdot \\texttt{Control}_{i,t}+\\sum_{l=0}^{L} \\gamma_{l}\\cdot MS_{t-l}+\\sum_{l=0}^{L} \\hat{\\gamma}_{l}\\cdot \\mathbf{1}^{dom}_{i,t}\\cdot MS_{t-l}+\\varepsilon_{i,t}\n",
    "$$\n",
    "where $ MS $ is the monetary shocks and $ \\texttt{Control} $ includes:\n",
    "\n",
    " 1. Age (by group dummies);\n",
    " 2. House ownershpi (by dummies for owning or renting a house);\n",
    " 3. Income growth."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "#%% Import Moduels\n",
    "\n",
    "## System Tools\n",
    "import os\n",
    "import numpy as np\n",
    "from collections.abc import Iterable\n",
    "#from collections import OrderedDict\n",
    "## I/O Tools\n",
    "import _pickle as pickle\n",
    "## Data Process Tools\n",
    "import pandas as pd\n",
    "import datetime\n",
    "## Graphs\n",
    "import matplotlib.pyplot as plt\n",
    "#import matplotlib.backends.backend_pdf as figpdf\n",
    "## Statistical Tools\n",
    "import statsmodels.formula.api as sm\n",
    "## Database API\n",
    "# from fredapi import Fred\n",
    "## Numerical API\n",
    "from scipy.interpolate import interp1d\n",
    "from scipy.optimize import bisect\n",
    "## Multi-Level Index Slicer\n",
    "idx = pd.IndexSlice\n",
    "\n",
    "import math \n",
    "import re\n",
    "# End of Section: Import Moduels\n",
    "###############################################################################\n",
    "\n",
    "\n",
    "#%% Setup Working Directory\n",
    "\n",
    "# Change to the Project Folder\n",
    "FolderList = [\"C:\\\\XingGuo\\\\Research\\\\CFM\\\\\" ]\n",
    "for Folder in FolderList:\n",
    "    if os.path.exists(Folder):\n",
    "        os.chdir(Folder)    \n",
    "\n",
    "# End of Section: Setup Working Directory\n",
    "###############################################################################"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "#%% Prepare for the Regression\n",
    "RegData = pickle.load(open(\"Data\\\\Data_ForRegression.p\",'rb'))\n",
    "MergedDS = RegData['DS']\n",
    "MS = RegData['MS']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "       Growth_Consumption  Growth_Consumption_Dur  Growth_Consumption_NonDur\n",
      "count            38007.00                28686.00                   37957.00\n",
      "mean                -1.64                   -5.92                      -0.89\n",
      "std                 61.46                  190.34                      56.17\n",
      "min               -464.30                -1062.76                    -433.85\n",
      "1%                -174.47                 -504.72                    -175.02\n",
      "5%                 -98.30                 -330.03                     -84.20\n",
      "10%                -70.04                 -241.35                     -57.85\n",
      "25%                -32.82                 -111.55                     -26.43\n",
      "50%                 -1.21                   -2.59                      -0.75\n",
      "75%                 29.93                  100.05                      24.46\n",
      "90%                 66.75                  228.15                      55.86\n",
      "95%                 93.59                  308.82                      82.11\n",
      "99%                168.51                  481.51                     176.45\n",
      "max                646.58                  858.20                     427.33\n"
     ]
    }
   ],
   "source": [
    "#%% Setup\n",
    "\n",
    "### Prepare the Sample\n",
    "RegDS = MergedDS.copy()\n",
    "RegDS['Flag_PosDurConsumption'] = RegDS['Flag_PosDurConsumption']*1\n",
    "\n",
    "## Merge with the MS Data\n",
    "TempMS = MS.sort_values('Date').reset_index(drop=True)\n",
    "TempMS['T_M'] = TempMS['Date'].apply(lambda x: x.year*12+x.month)\n",
    "LagList = list(range(-12,12))\n",
    "for Lag in LagList:    \n",
    "    TempMS['MS_L'+str(Lag) if Lag>=0 else 'MS_F'+str(-Lag)] = TempMS['MonetaryShocks'].shift(Lag)\n",
    "    \n",
    "TempMS = TempMS[['T_M']+['MS_L'+str(Lag) if Lag>=0 else 'MS_F'+str(-Lag) for Lag in LagList]]\n",
    "\n",
    "RegDS = RegDS.merge(right=TempMS,how='left',left_on='T_M',right_on='T_M')\n",
    "RegDS['Month'] = RegDS['period'].dt.month\n",
    "\n",
    "## Tablulate the Key Variables of Interest\n",
    "ConsGrowthVarList = ['Growth_Consumption','Growth_Consumption_Dur','Growth_Consumption_NonDur']\n",
    "print(np.round(RegDS[ConsGrowthVarList].describe(percentiles=[0.01,0.05,0.1,0.25,0.5,0.75,0.9,0.95,0.99]),2))\n",
    "\n",
    "## Winsorization\n",
    "TempVarList = ConsGrowthVarList+['Growth_Asset_Total','Growth_Liability_Total','Growth_Income']\n",
    "for vv in TempVarList:\n",
    "    Cutoff = RegDS[vv].quantile([0.01,0.99]).values\n",
    "    TempInd = (RegDS[vv]<Cutoff[0]) | (RegDS[vv]>Cutoff[1])\n",
    "    RegDS.loc[TempInd,vv] = np.nan\n",
    "\n",
    "## Regression Design\n",
    "RegLagList = list(range(0,12))\n",
    "MSList = ['MS_L'+str(Lag) if Lag>=0 else 'MS_F'+str(-Lag) for Lag in RegLagList]\n",
    "InDepVar_1 = {'MS': '+'.join([xx for xx in MSList]), \\\n",
    "              'Control':'+'.join(['C(OwnRent)','C(AgeGroup)','Growth_Income']) }\n",
    "InDepVar_2 = {'MS': '+'.join(['C(Flag_ExoFin, Treatment(reference=True))*'+xx for xx in MSList]), \\\n",
    "              'Control':'+'.join(['C(OwnRent)','C(AgeGroup)','Growth_Income']) }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Regression without the Dummies for International Financial Market Exposure"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "#%% Regressions\n",
    "DepVarList = ['Growth_Consumption','Growth_Consumption_Dur','Growth_Consumption_NonDur']\n",
    "\n",
    "## Simple Regression\n",
    "RegModelList_1 = [sm.ols(formula=xx+'~'+'+'.join(list(InDepVar_1.values())),data=RegDS).fit() for xx in DepVarList]\n",
    "\n",
    "def Temp_Collect_Simple(Coef):\n",
    "    Temp = Coef[['MS_L'+str(xx) for xx in RegLagList]]\n",
    "    Temp.index = [int(re.findall('MS_L(\\d+)',xx)[0]) for xx in Temp.index]\n",
    "    return Temp"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">Growth_Consumption</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Growth_Consumption_Dur</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Growth_Consumption_NonDur</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0.63</td>\n",
       "      <td>0.31</td>\n",
       "      <td>-0.55</td>\n",
       "      <td>-0.07</td>\n",
       "      <td>-0.68</td>\n",
       "      <td>-0.38</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>5.87</td>\n",
       "      <td>2.80</td>\n",
       "      <td>-0.23</td>\n",
       "      <td>-0.03</td>\n",
       "      <td>5.89</td>\n",
       "      <td>3.16</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-0.46</td>\n",
       "      <td>-0.23</td>\n",
       "      <td>1.20</td>\n",
       "      <td>0.16</td>\n",
       "      <td>-0.64</td>\n",
       "      <td>-0.36</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-2.49</td>\n",
       "      <td>-1.26</td>\n",
       "      <td>-8.17</td>\n",
       "      <td>-1.11</td>\n",
       "      <td>-0.68</td>\n",
       "      <td>-0.39</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.27</td>\n",
       "      <td>-0.14</td>\n",
       "      <td>-13.87</td>\n",
       "      <td>-1.96</td>\n",
       "      <td>2.70</td>\n",
       "      <td>1.59</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>1.35</td>\n",
       "      <td>0.70</td>\n",
       "      <td>-0.40</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>0.55</td>\n",
       "      <td>0.32</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-1.73</td>\n",
       "      <td>-0.92</td>\n",
       "      <td>-4.10</td>\n",
       "      <td>-0.58</td>\n",
       "      <td>-1.74</td>\n",
       "      <td>-1.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-1.15</td>\n",
       "      <td>-0.59</td>\n",
       "      <td>-7.41</td>\n",
       "      <td>-1.01</td>\n",
       "      <td>-0.60</td>\n",
       "      <td>-0.34</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-0.26</td>\n",
       "      <td>-0.13</td>\n",
       "      <td>-0.15</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>-1.23</td>\n",
       "      <td>-0.71</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>-2.04</td>\n",
       "      <td>-1.06</td>\n",
       "      <td>-9.88</td>\n",
       "      <td>-1.38</td>\n",
       "      <td>-0.34</td>\n",
       "      <td>-0.20</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>0.15</td>\n",
       "      <td>0.08</td>\n",
       "      <td>-12.43</td>\n",
       "      <td>-1.83</td>\n",
       "      <td>4.23</td>\n",
       "      <td>2.62</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>0.55</td>\n",
       "      <td>0.28</td>\n",
       "      <td>-10.31</td>\n",
       "      <td>-1.45</td>\n",
       "      <td>1.60</td>\n",
       "      <td>0.93</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Growth_Consumption         Growth_Consumption_Dur          \\\n",
       "                 Coef t-Value                   Coef t-Value   \n",
       "0                0.63    0.31                  -0.55   -0.07   \n",
       "1                5.87    2.80                  -0.23   -0.03   \n",
       "2               -0.46   -0.23                   1.20    0.16   \n",
       "3               -2.49   -1.26                  -8.17   -1.11   \n",
       "4               -0.27   -0.14                 -13.87   -1.96   \n",
       "5                1.35    0.70                  -0.40   -0.05   \n",
       "6               -1.73   -0.92                  -4.10   -0.58   \n",
       "7               -1.15   -0.59                  -7.41   -1.01   \n",
       "8               -0.26   -0.13                  -0.15   -0.02   \n",
       "9               -2.04   -1.06                  -9.88   -1.38   \n",
       "10               0.15    0.08                 -12.43   -1.83   \n",
       "11               0.55    0.28                 -10.31   -1.45   \n",
       "\n",
       "   Growth_Consumption_NonDur          \n",
       "                        Coef t-Value  \n",
       "0                      -0.68   -0.38  \n",
       "1                       5.89    3.16  \n",
       "2                      -0.64   -0.36  \n",
       "3                      -0.68   -0.39  \n",
       "4                       2.70    1.59  \n",
       "5                       0.55    0.32  \n",
       "6                      -1.74   -1.03  \n",
       "7                      -0.60   -0.34  \n",
       "8                      -1.23   -0.71  \n",
       "9                      -0.34   -0.20  \n",
       "10                      4.23    2.62  \n",
       "11                      1.60    0.93  "
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Coef = pd.concat([Temp_Collect_Simple(RR.params) for RR in RegModelList_1],axis=1,keys=DepVarList)\n",
    "Tvalue = pd.concat([Temp_Collect_Simple(RR.tvalues) for RR in RegModelList_1],axis=1,keys=DepVarList)\n",
    "RegResult_1 = pd.concat([Coef,Tvalue],axis=1,keys=['Coef','t-Value']).swaplevel(axis=1).sort_index(axis=1)\n",
    "np.round(RegResult_1,2)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Regression with the Dummies for International Financial Market Exposure"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [],
   "source": [
    "## Regression w/ Interaction\n",
    "RegModelList_2 = [sm.ols(formula=xx+'~'+'+'.join(list(InDepVar_2.values())),data=RegDS).fit() for xx in DepVarList]\n",
    "\n",
    "def Temp_Collect_2(Coef):\n",
    "    Temp_1 = Coef[[not re.findall(':(MS_L\\d+)$',xx)==[] for xx in Coef.index]].rename('Dom-Exo')\n",
    "    Temp_1.index = [int(re.findall(':MS_L(\\d+)$',xx)[0]) for xx in Temp_1.index]\n",
    "    Temp_2 = Coef[['MS_L'+str(xx) for xx in RegLagList]].rename('Exo')\n",
    "    Temp_2.index = [int(re.findall('MS_L(\\d+)',xx)[0]) for xx in Temp_2.index]\n",
    "\n",
    "    return pd.concat([Temp_1,Temp_2],axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"4\" halign=\"left\">Growth_Consumption</th>\n",
       "      <th colspan=\"4\" halign=\"left\">Growth_Consumption_Dur</th>\n",
       "      <th colspan=\"4\" halign=\"left\">Growth_Consumption_NonDur</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th colspan=\"2\" halign=\"left\">Dom-Exo</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Exo</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Dom-Exo</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Exo</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Dom-Exo</th>\n",
       "      <th colspan=\"2\" halign=\"left\">Exo</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th></th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "      <th>Coef</th>\n",
       "      <th>t-Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-3.34</td>\n",
       "      <td>-0.65</td>\n",
       "      <td>3.33</td>\n",
       "      <td>0.72</td>\n",
       "      <td>-5.52</td>\n",
       "      <td>-0.30</td>\n",
       "      <td>2.91</td>\n",
       "      <td>0.18</td>\n",
       "      <td>-1.90</td>\n",
       "      <td>-0.41</td>\n",
       "      <td>1.03</td>\n",
       "      <td>0.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-11.42</td>\n",
       "      <td>-2.06</td>\n",
       "      <td>15.51</td>\n",
       "      <td>3.08</td>\n",
       "      <td>-28.84</td>\n",
       "      <td>-1.47</td>\n",
       "      <td>21.84</td>\n",
       "      <td>1.24</td>\n",
       "      <td>-2.29</td>\n",
       "      <td>-0.46</td>\n",
       "      <td>8.19</td>\n",
       "      <td>1.83</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-2.72</td>\n",
       "      <td>-0.51</td>\n",
       "      <td>1.68</td>\n",
       "      <td>0.35</td>\n",
       "      <td>27.61</td>\n",
       "      <td>1.47</td>\n",
       "      <td>-20.57</td>\n",
       "      <td>-1.22</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>-0.01</td>\n",
       "      <td>-0.90</td>\n",
       "      <td>-0.21</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>2.45</td>\n",
       "      <td>0.46</td>\n",
       "      <td>-4.55</td>\n",
       "      <td>-0.94</td>\n",
       "      <td>-23.58</td>\n",
       "      <td>-1.25</td>\n",
       "      <td>9.68</td>\n",
       "      <td>0.57</td>\n",
       "      <td>0.75</td>\n",
       "      <td>0.16</td>\n",
       "      <td>-0.95</td>\n",
       "      <td>-0.22</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.87</td>\n",
       "      <td>-0.17</td>\n",
       "      <td>0.59</td>\n",
       "      <td>0.13</td>\n",
       "      <td>-7.97</td>\n",
       "      <td>-0.44</td>\n",
       "      <td>-7.81</td>\n",
       "      <td>-0.48</td>\n",
       "      <td>-3.26</td>\n",
       "      <td>-0.71</td>\n",
       "      <td>5.73</td>\n",
       "      <td>1.37</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-2.83</td>\n",
       "      <td>-0.55</td>\n",
       "      <td>3.33</td>\n",
       "      <td>0.72</td>\n",
       "      <td>11.16</td>\n",
       "      <td>0.61</td>\n",
       "      <td>-9.90</td>\n",
       "      <td>-0.61</td>\n",
       "      <td>-4.51</td>\n",
       "      <td>-0.99</td>\n",
       "      <td>4.00</td>\n",
       "      <td>0.96</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-4.48</td>\n",
       "      <td>-0.90</td>\n",
       "      <td>2.01</td>\n",
       "      <td>0.44</td>\n",
       "      <td>-3.16</td>\n",
       "      <td>-0.18</td>\n",
       "      <td>-2.78</td>\n",
       "      <td>-0.18</td>\n",
       "      <td>-1.93</td>\n",
       "      <td>-0.44</td>\n",
       "      <td>-0.08</td>\n",
       "      <td>-0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-1.67</td>\n",
       "      <td>-0.32</td>\n",
       "      <td>0.06</td>\n",
       "      <td>0.01</td>\n",
       "      <td>-7.36</td>\n",
       "      <td>-0.40</td>\n",
       "      <td>-1.82</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>-4.59</td>\n",
       "      <td>-0.99</td>\n",
       "      <td>3.35</td>\n",
       "      <td>0.79</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-5.65</td>\n",
       "      <td>-1.10</td>\n",
       "      <td>3.79</td>\n",
       "      <td>0.81</td>\n",
       "      <td>-6.85</td>\n",
       "      <td>-0.38</td>\n",
       "      <td>2.15</td>\n",
       "      <td>0.13</td>\n",
       "      <td>-7.45</td>\n",
       "      <td>-1.63</td>\n",
       "      <td>4.69</td>\n",
       "      <td>1.13</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>2.15</td>\n",
       "      <td>0.41</td>\n",
       "      <td>-3.97</td>\n",
       "      <td>-0.84</td>\n",
       "      <td>4.48</td>\n",
       "      <td>0.24</td>\n",
       "      <td>-14.40</td>\n",
       "      <td>-0.87</td>\n",
       "      <td>2.65</td>\n",
       "      <td>0.57</td>\n",
       "      <td>-2.12</td>\n",
       "      <td>-0.50</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>-0.47</td>\n",
       "      <td>-0.10</td>\n",
       "      <td>0.35</td>\n",
       "      <td>0.08</td>\n",
       "      <td>-4.92</td>\n",
       "      <td>-0.29</td>\n",
       "      <td>-9.22</td>\n",
       "      <td>-0.61</td>\n",
       "      <td>-0.06</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>4.43</td>\n",
       "      <td>1.15</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>-0.27</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>0.50</td>\n",
       "      <td>0.11</td>\n",
       "      <td>-8.23</td>\n",
       "      <td>-0.45</td>\n",
       "      <td>-5.27</td>\n",
       "      <td>-0.32</td>\n",
       "      <td>-3.46</td>\n",
       "      <td>-0.75</td>\n",
       "      <td>4.30</td>\n",
       "      <td>1.03</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Growth_Consumption                        Growth_Consumption_Dur          \\\n",
       "              Dom-Exo            Exo                        Dom-Exo           \n",
       "                 Coef t-Value   Coef t-Value                   Coef t-Value   \n",
       "0               -3.34   -0.65   3.33    0.72                  -5.52   -0.30   \n",
       "1              -11.42   -2.06  15.51    3.08                 -28.84   -1.47   \n",
       "2               -2.72   -0.51   1.68    0.35                  27.61    1.47   \n",
       "3                2.45    0.46  -4.55   -0.94                 -23.58   -1.25   \n",
       "4               -0.87   -0.17   0.59    0.13                  -7.97   -0.44   \n",
       "5               -2.83   -0.55   3.33    0.72                  11.16    0.61   \n",
       "6               -4.48   -0.90   2.01    0.44                  -3.16   -0.18   \n",
       "7               -1.67   -0.32   0.06    0.01                  -7.36   -0.40   \n",
       "8               -5.65   -1.10   3.79    0.81                  -6.85   -0.38   \n",
       "9                2.15    0.41  -3.97   -0.84                   4.48    0.24   \n",
       "10              -0.47   -0.10   0.35    0.08                  -4.92   -0.29   \n",
       "11              -0.27   -0.05   0.50    0.11                  -8.23   -0.45   \n",
       "\n",
       "                  Growth_Consumption_NonDur                        \n",
       "      Exo                           Dom-Exo           Exo          \n",
       "     Coef t-Value                      Coef t-Value  Coef t-Value  \n",
       "0    2.91    0.18                     -1.90   -0.41  1.03    0.25  \n",
       "1   21.84    1.24                     -2.29   -0.46  8.19    1.83  \n",
       "2  -20.57   -1.22                     -0.04   -0.01 -0.90   -0.21  \n",
       "3    9.68    0.57                      0.75    0.16 -0.95   -0.22  \n",
       "4   -7.81   -0.48                     -3.26   -0.71  5.73    1.37  \n",
       "5   -9.90   -0.61                     -4.51   -0.99  4.00    0.96  \n",
       "6   -2.78   -0.18                     -1.93   -0.44 -0.08   -0.02  \n",
       "7   -1.82   -0.11                     -4.59   -0.99  3.35    0.79  \n",
       "8    2.15    0.13                     -7.45   -1.63  4.69    1.13  \n",
       "9  -14.40   -0.87                      2.65    0.57 -2.12   -0.50  \n",
       "10  -9.22   -0.61                     -0.06   -0.02  4.43    1.15  \n",
       "11  -5.27   -0.32                     -3.46   -0.75  4.30    1.03  "
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Coef = pd.concat([Temp_Collect_2(RR.params) for RR in RegModelList_2],axis=1,keys=DepVarList)\n",
    "Tvalue = pd.concat([Temp_Collect_2(RR.tvalues) for RR in RegModelList_2],axis=1,keys=DepVarList)\n",
    "RegResult_2 = pd.concat([Coef,Tvalue],axis=1,keys=['Coef','t-Value']).swaplevel(i=1,j=0,axis=1).swaplevel(i=1,j=2,axis=1).sort_index(axis=1)\n",
    "np.round(RegResult_2,2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
